package com.example.soap.endpoint;

import java.util.ArrayList;
import java.util.List;

import org.springframework.ws.server.endpoint.annotation.Endpoint;
import org.springframework.ws.server.endpoint.annotation.PayloadRoot;
import org.springframework.ws.server.endpoint.annotation.RequestPayload;
import org.springframework.ws.server.endpoint.annotation.ResponsePayload;

import com.example.soap.config.Global;
import com.example.soap.model.GetCxmtOneRequest;
import com.example.soap.model.GetCxmtOneResponse;
import com.example.soap.model.GetCxmtOneResponse.Rs;
import com.example.soap.model.GetCxmtOneResponse.Rs.Rt;

/**
 * 端点业务代码
 *
 * @author LiuGangQiang Create in 2025/09/04
 */
@Endpoint
public class CxmtOneEndpoint {

    @PayloadRoot(namespace = Global.NAMESPACE_URI, localPart = "GetCxmtOneRequest")
    @ResponsePayload
    public GetCxmtOneResponse getCxmtOneRequest(@RequestPayload GetCxmtOneRequest request) {
        GetCxmtOneResponse response = new GetCxmtOneResponse();
        Rs rs = new Rs();
        rs.setStatus("这是状态");
        rs.setMessage("这是消息");
        Rt rt1 = new Rt();
        rt1.setAs4Text("A");
        rt1.setAs4User("B");
        rt1.setNametextc("C");
        rt1.setTrfuc("D");
        rt1.setTrkorr("E");
        Rt rt2 = new Rt();
        rt2.setAs4Text("AA");
        rt2.setAs4User("BB");
        rt2.setNametextc("CC");
        rt2.setTrfuc("DD");
        rt2.setTrkorr("EE");

        List<Rt> rts = new ArrayList<>();
        rts.add(rt1);
        rts.add(rt2);
        rs.getRt().addAll(rts);
        response.setRs(rs);
        return response;
    }
}
